<template>
  <a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol">
    <a-form-model-item label="车牌号">
      <a-input v-model="this.form.car_number" />
    </a-form-model-item>
    <a-form-model-item label="用户姓名">
      <a-input v-model="this.form.name" />
    </a-form-model-item>
    <a-form-model-item label="手机号">
      <a-input v-model="this.form.phone" />
    </a-form-model-item>
    <a-form-model-item label="派车单号">
      <a-input v-model="this.form.id" />
    </a-form-model-item>
    <!-- <a-form-model-item label="Activity zone">
      <a-select v-model="form.region" placeholder="please select your zone">
        <a-select-option value="shanghai"> Zone one </a-select-option>
        <a-select-option value="beijing"> Zone two </a-select-option>
      </a-select>
    </a-form-model-item> -->
    <a-form-model-item label="出车时间">
      <a-input v-model="this.form.send_time" />
    </a-form-model-item>
    <a-form-model-item label="目的位置">
      <a-input v-model="this.form.position" />
    </a-form-model-item>
    <!-- <a-form-model-item label="Resources">
      <a-radio-group v-model="form.resource">
        <a-radio value="1"> Sponsor </a-radio>
        <a-radio value="2"> Venue </a-radio>
      </a-radio-group>
    </a-form-model-item> -->
    <a-form-model-item label="借车说明">
      <a-input v-model="this.form.des" type="textarea" placeholder="输入借车说明" />
    </a-form-model-item>
    <a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
      <a-button type="primary" @click="onSubmit"> 同意 </a-button>
      <a-button style="margin-left: 10px"> 拒绝 </a-button>
    </a-form-model-item>
  </a-form-model>
</template>
 
<script>
// 派车单号  审核状态  state  员工名字 name 手机号 phone 车牌号 car_number
import { request, METHOD } from "@/utils/request";
export default {
  data() {
    return {
      api_str: "http://localhost:8088/order/first_car",
      loading: false,
      rev_data: "收到的响应",
      labelCol: { span: 4 },
      wrapperCol: { span: 12 },
      form: {
        name: "this.rev_data.id",
        region: undefined,
        date1: undefined,
        delivery: false,
        type: [],
        resource: "",
        desc: 'this.rev_data.des',
        send_time: '',
        position: 'this.rev_data.position',
      },
    };
  },
  methods: {
    onSubmit() {
      this.loading = true;
      request(this.api_str, METHOD.GET)
        .then((res) => {
          console.log(res);
          this.loading = false;
          this.res_data = res.data.data;
          // this.form.send_time=res.data.data.send_time;
          this.form.name=res.data.data.id;
          this.form.position=res.data.data.position;
          this.form.des=res.data.data.des;
          console.log(res.data.data.id);
        })
        .catch((err) => {
          console.log(err);
          this.rev_data = err;
        });
        
    },
  },
  created(){
    request(this.api_str,METHOD.GET).then((res)=>{
      console.log(res);
          this.loading = false;
          this.res_data = res.data.data;
          // this.form.send_time=res.data.data.send_time;
          this.form.name=res.data.data.id;
          this.form.position=res.data.data.position;
          this.form.des=res.data.data.des;
          console.log(res.data.data.id);
    })
  }
  // created: function () {
  //   setTimeout(() => {
  //     this.loading = true;
  //     request(this.api_str, METHOD.GET)
  //       .then((result) => {
  //         // this.loading = false;
  //         console.log(result);
  //         this.rev_data = result.data;
  //       })
  //       .catch((err) => {
  //         this.rev_data = err;
  //       });
  //   }, 100);
  // },
};
</script>
 
<style>
</style>